<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>打印机设置 - {{ printer_name }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container mt-5">
        <h1 class="mb-4">打印机设置: {{ printer_name }}</h1>

        <form method="POST" action="{{ url_for('printer.print_preview') }}">
            <input type="hidden" name="printer_name" value="{{ printer_name }}">

            <div class="card mb-3">
                <div class="card-header">基本设置</div>
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label for="page_size" class="form-label">纸张大小</label>
                            <select id="page_size" name="page_size" class="form-select">
                                {% for option in options.page_size %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label for="orientation" class="form-label">方向</label>
                            <select id="orientation" name="orientation" class="form-select">
                                {% for option in options.orientation %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card mb-3">
                <div class="card-header">颜色和质量</div>
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label for="color_mode" class="form-label">颜色模式</label>
                            <select id="color_mode" name="color_mode" class="form-select">
                                {% for option in options.color_mode %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label for="quality" class="form-label">打印质量</label>
                            <select id="quality" name="quality" class="form-select">
                                {% for option in options.quality %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card mb-3">
                <div class="card-header">高级选项</div>
                <div class="card-body">
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label for="duplex" class="form-label">双面打印</label>
                            <select id="duplex" name="duplex" class="form-select">
                                {% for option in options.duplex %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-6">
                            <label for="copies" class="form-label">打印份数</label>
                            <select id="copies" name="copies" class="form-select">
                                {% for option in options.copies %}
                                    <option value="{{ option }}">{{ option }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="d-grid gap-2 d-md-flex justify-content-md-end mt-4">
                <button type="button" class="btn btn-outline-secondary me-md-2" onclick="history.back()">
                    返回
                </button>
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-printer"></i> 预览并打印
                </button>
            </div>
        </form>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>